-- @nsURI XML=http://www.eclipse.org/am3/2007/XML -- @nsURI MAST2=http://mast.unican.es/ecoremast/Mast2 -- Header section module XML_to_MAST2; create OUTmodel : MAST2 from INmodel : XML; -- ***************************************************************************** -- ************************* ATTRIBUTE helpers ********************************* -- ***************************************************************************** -- ***************************************************************************** -- ************************* Functional HELPERS ******************************** -- ***************************************************************************** helper context XML!Element def : hasAttributes() : Boolean = let attrSeq : Sequence(XML!Attribute) = self.children -> select(e | e.oclIsTypeOf(XML!Attribute)) in if attrSeq -> isEmpty() then false else true endif; helper context XML!Element def : getAttributes() : Sequence(XML!Attribute) = self.children -> select(e | e.oclIsTypeOf(XML!Attribute)); helper context XML!Element def : hasAttribute(attrName : String) : Boolean = self.getAttributes() -> exists(attr | attr.name = attrName); helper context XML!Element def : getStringAttrValue(attrName : String) : String = self.getAttributes() -> select(attr | attr.name = attrName) -> first().value; helper context XML!Element def : getIntAttrValue(attrName : String) : Integer = self.getStringAttrValue(attrName).toInteger(); helper context XML!Element def : getRealAttrValue(attrName : String) : Real = self.getStringAttrValue(attrName).toReal(); helper context XML!Element def : getBoolAttrValue(attrName : String) : Boolean = let value : String = self.getStringAttrValue(attrName) in if value = 'YES' then true else false endif; helper context XML!Element def : hasChildrenElem() : Boolean = let childrenElemSeq : Sequence(XML!Element) = self.children -> select(e | e.oclIsTypeOf(XML!Element)) in if childrenElemSeq -> isEmpty() then false else true endif; helper context XML!Element def : hasChildrenElemByName(name : String) : Boolean = self.getChildrenElem() -> exists(childElem | childElem.name = name); helper context XML!Element def : hasChildrenElemByPreffix(preffix : String) : Boolean = self.getChildrenElem() -> exists(childElem | childElem.name.startsWith(preffix)); helper context XML!Element def : getChildrenElem() : Sequence(XML!Element) = self.children -> select(child | child.oclIsTypeOf(XML!Element)); helper context XML!Element def : getChildrenElemByName(name : String) : Sequence(XML!Element) = self.getChildrenElem() -> select(childElem | childElem.name = name); helper context XML!Element def : getChildrenElemByNotName(name : String) : Sequence(XML!Element) = self.getChildrenElem() -> select(childElem | childElem.name <> name); helper context XML!Element def : getChildrenElemByPreffix(preffix : String) : Sequence(XML!Element) = self.getChildrenElem() -> select(childElem | childElem.name.startsWith(preffix)); helper context XML!Element def : getChildrenElemByNotPreffix(preffix : String) : Sequence(XML!Element) = self.getChildrenElem() -> select(childElem | not childElem.name.startsWith(preffix)); helper context XML!Element def : getChildrenTextNode() : Sequence(XML!Text) = self.children -> select(child | child.oclIsTypeOf(XML!Text)); -- ***************************************************************************** -- ************************* MATCHED RULES ************************************* -- ***************************************************************************** --- ---------- --- This rule ... --- ---------- rule Root_Elem { from input : XML!Root to output : MAST2!Mast_Model ( -- attrs. name <- input.getStringAttrValue('Model_Name'), Date <- input.getStringAttrValue('Model_Date'), System_PiP_Behavior <- if input.hasAttribute('System_PiP_Behaviour') then input.getStringAttrValue('System_PiP_Behaviour') else OclUndefined endif, Event_Queueing_Policy <- if input.hasAttribute('Step_Queueing_Policy') then input.getStringAttrValue('Step_Queueing_Policy') else OclUndefined endif, -- refs. Element_List <- input.getChildrenElemByNotName('mast_mdl:Clock_Synchronization_Object') ) } --- ---------- --- This rule ... --- ---------- abstract rule Model_Element { from input : XML!Element to output : MAST2!Model_Element ( -- attrs. name <- input.getStringAttrValue('Name') -- refs. -- Model <- ) } -- ----------------------- -- SYNCHRONIZATION OBJECTS -- ----------------------- --- ---------- --- This rule ... --- ---------- --rule Clock_Synchronization_Object -- ------ -- TIMERS -- ------ --- ---------- --- This rule ... --- ---------- abstract rule Timer { --extends Model_Element { from input : XML!Element to output : MAST2!Timer ( -- attrs. name <- input.getStringAttrValue('Name'), Max_Overhead <- if input.hasAttribute('Max_Overhead') then input.getRealAttrValue('Max_Overhead') else OclUndefined endif, Avg_Overhead <- if input.hasAttribute('Avg_Overhead') then input.getRealAttrValue('Avg_Overhead') else OclUndefined endif, Min_Overhead <- if input.hasAttribute('Min_Overhead') then input.getRealAttrValue('Min_Overhead') else OclUndefined endif, Accuracy <- if input.hasAttribute('Precision') then input.getRealAttrValue('Precision') else OclUndefined endif, Is_Locally_Synchronized <- if input.hasAttribute('Is_Locally_Synchronized') then input.getBoolAttrValue('Is_Locally_Synchronized') else OclUndefined endif -- refs. -- Model <- -- Host <- ) } --- ---------- --- This rule ... --- ---------- rule Alarm_Clock extends Timer { from input : XML!Element (input.name = 'mast_mdl:Alarm_Clock') to output : MAST2!Alarm_Clock () } --- ---------- --- This rule ... --- ---------- rule Ticker extends Timer { from input : XML!Element (input.name = 'mast_mdl:Ticker') to output : MAST2!Ticker ( -- attrs. Period <- if input.hasAttribute('Period') then input.getRealAttrValue('Period') else OclUndefined endif ) } -- -------------------- -- PROCESSING RESOURCES -- -------------------- --- ---------- --- This rule ... --- ---------- abstract rule Processing_Resource { --extends Model_Element { from input : XML!Element to output : MAST2!Processing_Resource ( -- attrs. name <- input.getStringAttrValue('Name'), Speed_Factor <- if input.hasAttribute('Speed_Factor') then input.getRealAttrValue('Speed_Factor') else OclUndefined endif --refs. -- Model <- -- Scheduler <- -- Synchronization_Source <- {do section} ) } --- ---------- --- This rule ... --- ---------- rule Regular_Processor extends Processing_Resource { from input : XML!Element (input.name = 'mast_mdl:Regular_Processor') to output : MAST2!Regular_Processor ( -- attrs. Worst_ISR_Switch <- if input.hasAttribute('Worst_ISR_Switch') then input.getRealAttrValue('Worst_ISR_Switch') else OclUndefined endif, Avg_ISR_Switch <- if input.hasAttribute('Avg_ISR_Switch') then input.getRealAttrValue('Avg_ISR_Switch') else OclUndefined endif, Best_ISR_Switch <- if input.hasAttribute('Best_ISR_Switch') then input.getRealAttrValue('Best_ISR_Switch') else OclUndefined endif, Max_Interrupt_Priority <- if input.hasAttribute('Max_Interrupt_Priority') then input.getIntAttrValue('Max_Interrupt_Priority') else OclUndefined endif, Min_Interrupt_Priority <- if input.hasAttribute('Min_Interrupt_Priority') then input.getIntAttrValue('Min_Interrupt_Priority') else OclUndefined endif --refs. -- Synchronization_Source <- {do section} -- System_Timer <- {do section} -- Timer_List <- {do section} ) do { if (input.hasAttribute('Synchronization_Source')) output.Synchronization_Source <- output.Model.Element_List -> select(e | e.oclIsType(MAST2!Clock_Synchronization_Object)) -> select(c | c.name = input.getStringAttrValue('Synchronization_Source')) -> first(); if (input.hasAttribute('System_Timer')) output.System_Timer <- output.Model.Element_List -> select(e | e.oclIsKindOf(MAST2!Timer)) -> select(t | t.name = input.getStringAttrValue('System_Timer')) -> first(); if (input.hasChildrenElemByName('mast_mdl:Timer')) { for (timerElem in input.getChildrenElemByName('mast_mdl:Timer')) { output.Timer_List <- output.Model.Element_List -> select(e | e.oclIsKindOf(MAST2!Timer)) -> select(t | t.name = timerElem.getStringAttrValue('Name')) -> first(); } } } } --- ---------- --- This rule ... --- ---------- rule Packet_Based_Network extends Processing_Resource { from input : XML!Element (input.name = 'mast_mdl:Packet_Based_Network') to output : MAST2!Packet_Based_Network ( -- attrs. Throughput <- if input.hasAttribute('Throughput') then input.getIntAttrValue('Throughput') else OclUndefined endif, Transmission_Kind <- if input.hasAttribute('Transmission_Kind') then input.getStringAttrValue('Transmission_Kind') else OclUndefined endif, Max_Blocking <- if input.hasAttribute('Max_Blocking') then input.getRealAttrValue('Max_Blocking') else OclUndefined endif, Max_Packet_Size <- if input.hasAttribute('Max_Packet_Size') then input.getIntAttrValue('Max_Packet_Size') else OclUndefined endif, Min_Packet_Size <- if input.hasAttribute('Min_Packet_Size') then input.getIntAttrValue('Min_Packet_Size') else OclUndefined endif, -- refs. -- Synchronization_Source <- {do section} Driver_List <- if input.hasChildrenElem() then input.getChildrenElem() -- -> select(e | e.name = 'mast_mdl:Packet_Driver' or e.name = 'mast_mdl:Character_Packet_Driver') else OclUndefined endif ) do { if (input.hasAttribute('Synchronization_Source')) output.Synchronization_Source <- output.Model.Element_List -> select(e | e.oclIsType(MAST2!Clock_Synchronization_Object)) -> select(c | c.name = input.getStringAttrValue('Synchronization_Source')) -> first(); } } --- ---------- --- This rule ... --- ---------- rule RTEP_Network extends Processing_Resource { from input : XML!Element (input.name = 'mast_mdl:RTEP_Network') to output : MAST2!RTEP_Network ( -- attrs. Throughput <- if input.hasAttribute('Throughput') then input.getIntAttrValue('Throughput') else OclUndefined endif, Transmission_Kind <- if input.hasAttribute('Transmission_Kind') then input.getStringAttrValue('Transmission_Kind') else OclUndefined endif, Max_Blocking <- if input.hasAttribute('Max_Blocking') then input.getRealAttrValue('Max_Blocking') else OclUndefined endif, Max_Packet_Size <- if input.hasAttribute('Max_Packet_Size') then input.getIntAttrValue('Max_Packet_Size') else OclUndefined endif, Min_Packet_Size <- if input.hasAttribute('Min_Packet_Size') then input.getIntAttrValue('Min_Packet_Size') else OclUndefined endif, Number_Of_Stations <- if input.hasAttribute('Number_Of_Stations') then input.getIntAttrValue('Number_Of_Stations') else OclUndefined endif, Token_Delay <- if input.hasAttribute('Token_Delay') then input.getRealAttrValue('Token_Delay') else OclUndefined endif, Failure_Timeout <- if input.hasAttribute('Failure_Timeout') then input.getRealAttrValue('Failure_Timeout') else OclUndefined endif, Token_Transmission_Retries <- if input.hasAttribute('Token_Transmission_Retries') then input.getIntAttrValue('Token_Transmission_Retries') else OclUndefined endif, Packet_Transmission_Retries <- if input.hasAttribute('Packet_Transmission_Retries') then input.getIntAttrValue('Packet_Transmission_Retries') else OclUndefined endif, Arbitration_Token_Size <- if input.hasAttribute('Arbitration_Token_Size') then input.getIntAttrValue('Arbitration_Token_Size') else OclUndefined endif, Transmit_Token_Size <- if input.hasAttribute('Transmitt_Token_Size') then input.getIntAttrValue('Transmitt_Token_Size') else OclUndefined endif, -- refs. -- Synchronization_Source <- {do section} -- Driver_List <- if input.hasChildrenElemByName('mast_mdl:RTEP_Packet_Driver') then -- input.getChildrenElemByName('mast_mdl:RTEP_Packet_Driver') -- else -- OclUndefined -- endif Driver_List <- if input.hasChildrenElem() then input.getChildrenElem() else OclUndefined endif ) do { if (input.hasAttribute('Synchronization_Source')) output.Synchronization_Source <- output.Model.Element_List -> select(e | e.oclIsType(MAST2!Clock_Synchronization_Object)) -> select(c | c.name = input.getStringAttrValue('Synchronization_Source')) -> first(); } } --- ---------- --- This rule ... --- ---------- rule AFDX_Link extends Processing_Resource { from input : XML!Element (input.name = 'mast_mdl:AFDX_Link') to output : MAST2!AFDX_Link ( -- attrs. Throughput <- if input.hasAttribute('Throughput') then input.getIntAttrValue('Throughput') else OclUndefined endif, Max_Packet_Size <- if input.hasAttribute('Max_Packet_Size') then input.getIntAttrValue('Max_Packet_Size') else OclUndefined endif, Min_Packet_Size <- if input.hasAttribute('Min_Packet_Size') then input.getIntAttrValue('Min_Packet_Size') else OclUndefined endif, Max_HW_Tx_Latency <- if input.hasAttribute('Max_HW_Tx_Latency') then input.getRealAttrValue('Max_HW_Tx_Latency') else OclUndefined endif, Avg_HW_Tx_Latency <- if input.hasAttribute('Avg_HW_Tx_Latency') then input.getRealAttrValue('Avg_HW_Tx_Latency') else OclUndefined endif, Min_HW_Tx_Latency <- if input.hasAttribute('Min_HW_Tx_Latency') then input.getRealAttrValue('Min_HW_Tx_Latency') else OclUndefined endif, Max_HW_Rx_Latency <- if input.hasAttribute('Max_HW_Rx_Latency') then input.getRealAttrValue('Max_HW_Rx_Latency') else OclUndefined endif, Avg_HW_Rx_Latency <- if input.hasAttribute('Avg_HW_Rx_Latency') then input.getRealAttrValue('Avg_HW_Rx_Latency') else OclUndefined endif, Min_HW_Rx_Latency <- if input.hasAttribute('Min_HW_Rx_Latency') then input.getRealAttrValue('Min_HW_Rx_Latency') else OclUndefined endif, -- Ethernet_Overhead <- , -- Protocol_Overhead <- , -- refs. -- Synchronization_Source <- {do section} -- Driver_List <- if input.hasChildrenElemByName('mast_mdl:Packet_Driver') then -- input.getChildrenElemByName('mast_mdl:Packet_Driver') -- else -- OclUndefined -- endif Driver_List <- if input.hasChildrenElem() then input.getChildrenElem() else OclUndefined endif ) do { if (input.hasAttribute('Synchronization_Source')) output.Synchronization_Source <- output.Model.Element_List -> select(e | e.oclIsType(MAST2!Clock_Synchronization_Object)) -> select(c | c.name = input.getStringAttrValue('Synchronization_Source')) -> first(); } } --- ---------- --- This rule ... --- ---------- rule Regular_Switch extends Processing_Resource { from input : XML!Element (input.name = 'mast_mdl:Regular_Switch') to output : MAST2!Regular_Switch ( -- attrs. -- refs. ) } --- ---------- --- This rule ... --- ---------- rule Regular_Router extends Processing_Resource { from input : XML!Element (input.name = 'mast_mdl:Regular_Router') to output : MAST2!Regular_Router ( -- attrs. -- refs. ) } --- ---------- --- This rule ... --- ---------- rule AFDX_Switch extends Processing_Resource { from input : XML!Element (input.name = 'mast_mdl:AFDX_Switch') to output : MAST2!AFDX_Switch ( -- attrs. -- refs. ) } -- ------- -- DRIVERS -- ------- --- ---------- --- This rule ... --- ---------- rule Packet_Driver { from input : XML!Element (input.name = 'mast_mdl:Packet_Driver') to output : MAST2!Packet_Driver ( -- attrs. Message_Segmentation <- if input.hasAttribute('Message_Partitioning') then input.getBoolAttrValue('Message_Partitioning') else OclUndefined endif, High_Utilization_Mode <- if input.hasAttribute('High_Utilization_Mode') then input.getBoolAttrValue('High_Utilization_Mode') else OclUndefined endif, -- refs. Packet_Server <- XML!Element.allInstances() -> select(e | e.hasAttribute('Name')) -> select(e | e.getStringAttrValue('Name') = input.getStringAttrValue('Packet_Server')) -> first(), Packet_Send_Operation <- if input.hasAttribute('Packet_Send_Operation') then XML!Element.allInstances() -> select(e | e.hasAttribute('Name')) -> select(e | e.getStringAttrValue('Name') = input.getStringAttrValue('Packet_Send_Operation')) -> first() else OclUndefined endif, Packet_Receive_Operation <- if input.hasAttribute('Packet_Receive_Operation') then XML!Element.allInstances() -> select(e | e.hasAttribute('Name')) -> select(e | e.getStringAttrValue('Name') = input.getStringAttrValue('Packet_Receive_Operation')) -> first() else OclUndefined endif ) do { -- output.Packet_Server <- output.Owner.Model.Element_List -> select(e | e.oclIsTypeOf(MAST2!Thread)) -> -- select(t | t.name = input.getStringAttrValue('Packet_Server')) -> first(); -- if (input.hasAttribute('Packet_Send_Operation')) -- output.Packet_Send_Operation <- output.Owner.Model.Element_List -> select(e | e.oclIsKindOf(MAST2!Code_Operation)) -> -- select(o | o.name = input.getStringAttrValue('Packet_Send_Operation')) -> first(); -- if (input.hasAttribute('Packet_Receive_Operation')) -- output.Packet_Receive_Operation <- output.Owner.Model.Element_List -> select(e | e.oclIsKindOf(MAST2!Code_Operation)) -> -- select(o | o.name = input.getStringAttrValue('Packet_Receive_Operation')) -> first(); } } --- ---------- --- This rule ... --- ---------- rule Character_Packet_Driver extends Packet_Driver { from input : XML!Element (input.name = 'mast_mdl:Character_Packet_Driver') to output : MAST2!Character_Packet_Driver ( -- attrs. Character_Transmission_Time <- if input.hasAttribute('Character_Transmission_Time') then input.getRealAttrValue('Character_Transmission_Time') else OclUndefined endif, -- refs. Character_Server <- XML!Element.allInstances() -> select(e | e.hasAttribute('Name')) -> select(e | e.getStringAttrValue('Name') = input.getStringAttrValue('Character_Server')) -> first(), Character_Send_Operation <- if input.hasAttribute('Character_Send_Operation') then XML!Element.allInstances() -> select(e | e.hasAttribute('Name')) -> select(e | e.getStringAttrValue('Name') = input.getStringAttrValue('Character_Send_Operation')) -> first() else OclUndefined endif, Character_Receive_Operation <- if input.hasAttribute('Character_Receive_Operation') then XML!Element.allInstances() -> select(e | e.hasAttribute('Name')) -> select(e | e.getStringAttrValue('Name') = input.getStringAttrValue('Character_Receive_Operation')) -> first() else OclUndefined endif ) do { -- output.Character_Server <- output.Owner.Model.Element_List -> select(e | e.oclIsTypeOf(MAST2!Thread)) -> -- select(t | t.name = input.getStringAttrValue('Character_Server')) -> first(); -- if (input.hasAttribute('Character_Send_Operation')) -- output.Character_Send_Operation <- output.Owner.Model.Element_List -> select(e | e.oclIsKindOf(MAST2!Operation)) -> -- select(o | o.name = input.getStringAttrValue('Character_Send_Operation')) -> first(); -- if (input.hasAttribute('Character_Receive_Operation')) -- output.Character_Receive_Operation <- output.Owner.Model.Element_List -> select(e | e.oclIsKindOf(MAST2!Operation)) -> -- select(o | o.name = input.getStringAttrValue('Character_Receive_Operation')) -> first(); } } --- ---------- --- This rule ... --- ---------- rule RTEP_Packet_Driver extends Packet_Driver { from input : XML!Element (input.name = 'mast_mdl:RTEP_Packet_Driver') to output : MAST2!RTEP_Packet_Driver ( -- attrs. Number_Of_Stations <- if input.hasAttribute('Number_Of_Stations') then input.getIntAttrValue('Number_Of_Stations') else OclUndefined endif, Token_Delay <- if input.hasAttribute('Token_Delay') then input.getRealAttrValue('Token_Delay') else OclUndefined endif, Failure_Timeout <- if input.hasAttribute('Failure_Timeout') then input.getRealAttrValue('Failure_Timeout') else OclUndefined endif, Token_Transmission_Retries <- if input.hasAttribute('Token_Transmission_Retries') then input.getIntAttrValue('Token_Transmission_Retries') else OclUndefined endif, Packet_Transmission_Retries <- if input.hasAttribute('Packet_Transmission_Retries') then input.getIntAttrValue('Packet_Transmission_Retries') else OclUndefined endif, -- refs. Packet_Interrupt_Server <- XML!Element.allInstances() -> select(e | e.hasAttribute('Name')) -> select(e | e.getStringAttrValue('Name') = input.getStringAttrValue('Packet_Interrupt_Server')) -> first(), Packet_ISR_Operation <- if input.hasAttribute('Packet_ISR_Operation') then XML!Element.allInstances() -> select(e | e.hasAttribute('Name')) -> select(e | e.getStringAttrValue('Name') = input.getStringAttrValue('Packet_ISR_Operation')) -> first() else OclUndefined endif, Token_Check_Operation <- if input.hasAttribute('Token_Check_Operation') then XML!Element.allInstances() -> select(e | e.hasAttribute('Name')) -> select(e | e.getStringAttrValue('Name') = input.getStringAttrValue('Token_Check_Operation')) -> first() else OclUndefined endif, Token_Manage_Operation <- if input.hasAttribute('Token_Manage_Operation') then XML!Element.allInstances() -> select(e | e.hasAttribute('Name')) -> select(e | e.getStringAttrValue('Name') = input.getStringAttrValue('Token_Manage_Operation')) -> first() else OclUndefined endif, Packet_Discard_Operation <- if input.hasAttribute('Packet_Discard_Operation') then XML!Element.allInstances() -> select(e | e.hasAttribute('Name')) -> select(e | e.getStringAttrValue('Name') = input.getStringAttrValue('Packet_Discard_Operation')) -> first() else OclUndefined endif, Token_Retransmission_Operation <- if input.hasAttribute('Token_Retransmission_Operation') then XML!Element.allInstances() -> select(e | e.hasAttribute('Name')) -> select(e | e.getStringAttrValue('Name') = input.getStringAttrValue('Token_Retransmission_Operation')) -> first() else OclUndefined endif, Packet_Retransmission_Operation <- if input.hasAttribute('Packet_Retransmission_Operation') then XML!Element.allInstances() -> select(e | e.hasAttribute('Name')) -> select(e | e.getStringAttrValue('Name') = input.getStringAttrValue('Packet_Retransmission_Operation')) -> first() else OclUndefined endif ) do { -- output.Packet_Interrupt_Server <- output.Owner.Model.Element_List -> select(e | e.oclIsTypeOf(MAST2!Thread)) -> -- select(t | t.name = input.getStringAttrValue('Packet_Interrupt_Server')) -> first(); -- if (input.hasAttribute('Packet_ISR_Operation')) -- output.Packet_ISR_Operation <- output.Owner.Model.Element_List -> select(e | e.oclIsKindOf(MAST2!Operation)) -> -- select(o | o.name = input.getStringAttrValue('Packet_ISR_Operation')) -> first(); -- if (input.hasAttribute('Token_Check_Operation')) -- output.Token_Check_Operation <- output.Owner.Model.Element_List -> select(e | e.oclIsKindOf(MAST2!Operation)) -> -- select(o | o.name = input.getStringAttrValue('Token_Check_Operation')) -> first(); -- if (input.hasAttribute('Token_Manage_Operation')) -- output.Token_Manage_Operation <- output.Owner.Model.Element_List -> select(e | e.oclIsKindOf(MAST2!Operation)) -> -- select(o | o.name = input.getStringAttrValue('Token_Manage_Operation')) -> first(); -- if (input.hasAttribute('Packet_Discard_Operation')) -- output.Packet_Discard_Operation <- output.Owner.Model.Element_List -> select(e | e.oclIsKindOf(MAST2!Operation)) -> -- select(o | o.name = input.getStringAttrValue('Packet_Discard_Operation')) -> first(); -- if (input.hasAttribute('Token_Retransmission_Operation')) -- output.Token_Retransmission_Operation <- output.Owner.Model.Element_List -> select(e | e.oclIsKindOf(MAST2!Operation)) -> -- select(o | o.name = input.getStringAttrValue('Token_Retransmission_Operation')) -> first(); -- if (input.hasAttribute('Packet_Retransmission_Operation')) -- output.Packet_Retransmission_Operation <- output.Owner.Model.Element_List -> select(e | e.oclIsKindOf(MAST2!Operation)) -> -- select(o | o.name = input.getStringAttrValue('Packet_Retransmission_Operation')) -> first(); } } -- ---------- -- SCHEDULERS -- ---------- --- ---------- --- This rule ... --- ---------- abstract rule Scheduler { --extends Model_Element { from input : XML!Element to output : MAST2!Scheduler ( -- attrs. name <- input.getStringAttrValue('Name'), -- refs. -- Model <- -- Schedulable_Resource_List <- Policy <- input.getChildrenElem() -> first() -- -> select(e | e.name = 'mast_mdl:Fixed_Priority_Policy' or -- e.name = 'mast_mdl:FP_Packet_Based_Policy' or -- e.name = 'mast_mdl:EDF_Policy' or -- e.name = 'mast_mdl:Timetable_Driven_Policy' or -- e.name = 'mast_mdl:Timetable_Driven_Packet_Based_Policy' or -- e.name = 'mast_mdl:AFDX_Policy') -> first() ) } --- ---------- --- This rule ... --- ---------- rule Primary_Scheduler extends Scheduler { from input : XML!Element (input.name = 'mast_mdl:Primary_Scheduler') to output : MAST2!Primary_Scheduler ( -- refs. -- Host <- {do section} ) do { output.Host <- output.Model.Element_List -> select(e | e.oclIsKindOf(MAST2!Processing_Resource)) -> select(pr | pr.name = input.getStringAttrValue('Host')) -> first(); } } --- ---------- --- This rule ... --- ---------- rule Secondary_Scheduler extends Scheduler { from input : XML!Element (input.name = 'mast_mdl:Secondary_Scheduler') to output : MAST2!Secondary_Scheduler ( -- refs. -- Host <- {do section} ) do { output.Host <- output.Model.Element_List -> select(e | e.oclIsKindOf(MAST2!Schedulable_Resource)) -> select(sr | sr.name = input.getStringAttrValue('Host')) -> first(); } } -- ------------------- -- SCHEDULING POLICIES -- ------------------- --- ---------- --- This rule ... --- ---------- rule Fixed_Priority_Policy { from input : XML!Element (input.name = 'mast_mdl:Fixed_Priority_Policy') to output : MAST2!Fixed_Priority_Policy ( -- attrs. Worst_Context_Switch <- if input.hasAttribute('Worst_Context_Switch') then input.getRealAttrValue('Worst_Context_Switch') else OclUndefined endif, Avg_Context_Switch <- if input.hasAttribute('Avg_Context_Switch') then input.getRealAttrValue('Avg_Context_Switch') else OclUndefined endif, Best_Context_Switch <- if input.hasAttribute('Best_Context_Switch') then input.getRealAttrValue('Best_Context_Switch') else OclUndefined endif, Max_Priority <- if input.hasAttribute('Max_Priority') then input.getIntAttrValue('Max_Priority') else OclUndefined endif, Min_Priority <- if input.hasAttribute('Min_Priority') then input.getIntAttrValue('Min_Priority') else OclUndefined endif -- refs. -- Owner <- ) } --- ---------- --- This rule ... --- ---------- rule EDF_Policy { from input : XML!Element (input.name = 'mast_mdl:EDF_Policy') to output : MAST2!EDF_Policy ( -- attrs. Worst_Context_Switch <- if input.hasAttribute('Worst_Context_Switch') then input.getRealAttrValue('Worst_Context_Switch') else OclUndefined endif, Avg_Context_Switch <- if input.hasAttribute('Avg_Context_Switch') then input.getRealAttrValue('Avg_Context_Switch') else OclUndefined endif, Best_Context_Switch <- if input.hasAttribute('Best_Context_Switch') then input.getRealAttrValue('Best_Context_Switch') else OclUndefined endif -- refs. -- Owner <- ) } --- ---------- --- This rule ... --- ---------- rule FP_Packet_Based_Policy { from input : XML!Element (input.name = 'mast_mdl:FP_Packet_Based_Policy') to output : MAST2!FP_Packet_Based_Policy ( -- attrs. Packet_Overhead_Max_Size <- if input.hasAttribute('Packet_Overhead_Max_Size') then input.getIntAttrValue('Packet_Overhead_Max_Size') else OclUndefined endif, Packet_Overhead_Avg_Size <- if input.hasAttribute('Packet_Overhead_Avg_Size') then input.getIntAttrValue('Packet_Overhead_Avg_Size') else OclUndefined endif, Packet_Overhead_Min_Size <- if input.hasAttribute('Packet_Overhead_Min_Size') then input.getIntAttrValue('Packet_Overhead_Min_Size') else OclUndefined endif, Max_Priority <- if input.hasAttribute('Max_Priority') then input.getIntAttrValue('Max_Priority') else OclUndefined endif, Min_Priority <- if input.hasAttribute('Min_Priority') then input.getIntAttrValue('Min_Priority') else OclUndefined endif -- refs. -- Owner <- ) } --- ---------- --- This rule ... --- ---------- rule Timetable_Driven_Policy { from input : XML!Element (input.name = 'mast_mdl:Timetable_Driven_Policy') to output : MAST2!Timetable_Driven_Policy ( -- attrs. -- refs. ) } --- ---------- --- This rule ... --- ---------- rule Timetable_Driven_Packet_Based_Policy { from input : XML!Element (input.name = 'mast_mdl:Timetable_Driven_Packet_Based_Policy') to output : MAST2!Timetable_Driven_Packet_Based_Policy ( -- attrs. -- refs. ) } --- ---------- --- This rule ... --- ---------- rule AFDX_Policy { from input : XML!Element (input.name = 'mast_mdl:AFDX_Policy') to output : MAST2!AFDX_Policy ( -- attrs. -- refs. ) } -- --------------------- -- SCHEDULABLE RESOURCES -- --------------------- --- ---------- --- This rule ... --- ---------- abstract rule Schedulable_Resource { --extends Model_Element { from input : XML!Element to output : MAST2!Schedulable_Resource ( -- attrs. name <- input.getStringAttrValue('Name'), -- refs. -- Model <- -- Scheduler <- {do section} Scheduling_Parameters <- input.getChildrenElemByNotName('mast_mdl:SRP_Params') -> first() ) } --- ---------- --- This rule ... --- ---------- rule Thread extends Schedulable_Resource { from input : XML!Element (input.name = 'mast_mdl:Thread') using { synchParamsElem : XML!Element = input.getChildrenElemByName('mast_mdl:SRP_Params') -> first(); -- could be null } to output : MAST2!Thread ( -- refs. -- Scheduler <- {do section} -- Scheduling_Parameters <- input.getChildrenElem() -> select(e | e.name = 'mast_mdl:Interrupt_FP_Params' or -- e.name = 'mast_mdl:Fixed_Priority_Params' or -- e.name = 'mast_mdl:Non_Preemptible_FP_Params' or -- e.name = 'mast_mdl:Polling_Params' or -- e.name = 'mast_mdl:Periodic_Server_Params' or -- e.name = 'mast_mdl:Sporadic_Server_Params' or -- e.name = 'mast_mdl:EDF_Params' or -- e.name = 'mast_mdl:Timetable_Driven_Params' or -- e.name = 'mast_mdl:AFDX_Virtual_Link') -> first() Sychronization_Parameters <- if not synchParamsElem.oclIsUndefined() then synchParamsElem else OclUndefined endif ) do { output.Scheduler <- output.Model.Element_List -> select(e | e.oclIsKindOf(MAST2!Scheduler)) -> select(s | s.name = input.getStringAttrValue('Scheduler')) -> first(); } } --- ---------- --- This rule ... --- ---------- rule Communication_Channel extends Schedulable_Resource { from input : XML!Element (input.name = 'mast_mdl:Communication_Channel') to output : MAST2!Communication_Channel ( -- refs. -- Scheduler <- {do section} -- Scheduling_Parameters <- input.getChildrenElem() -> select(e | e.name = 'mast_mdl:Fixed_Priority_Params' or -- e.name = 'mast_mdl:Non_Preemptible_FP_Params' or -- e.name = 'mast_mdl:Polling_Params' or -- e.name = 'mast_mdl:Periodic_Server_Comm_Params' or -- e.name = 'mast_mdl:Sporadic_Server_Comm_Params' or -- e.name = 'mast_mdl:EDF_Params' or -- e.name = 'mast_mdl:Timetable_Driven_Params' or -- e.name = 'mast_mdl:AFDX_Virtual_Link') -> first() -- Scheduling_Parameters <- input.getChildrenElem() -> first() ) do { output.Scheduler <- output.Model.Element_List -> select(e | e.oclIsKindOf(MAST2!Scheduler)) -> select(s | s.name = input.getStringAttrValue('Scheduler')) -> first(); } } --- ---------- --- This rule ... --- ---------- rule Virtual_Schedulable_Resource { from input : XML!Element (input.name = 'mast_mdl:Virtual_Schedulable_Resource') to output : MAST2!Virtual_Schedulable_Resource ( -- attrs. -- refs. ) } --- ---------- --- This rule ... --- ---------- rule Virtual_Communication_Channel { from input : XML!Element (input.name = 'mast_mdl:Virtual_Communication_Channel') to output : MAST2!Virtual_Communication_Channel ( -- attrs. -- refs. ) } -- ------------ -- SYNC. PARAMS -- ------------ --- ---------- --- This rule ... --- ---------- rule SRP_Params { from input : XML!Element (input.name = 'mast_mdl:SRP_Params') to output : MAST2!SRP_Params ( -- attrs. Preemption_Level <- if input.hasAttribute('Preemption_Level') then input.getIntAttrValue('Preemption_Level') else OclUndefined endif, Preassigned <- if input.hasAttribute('Preassigned') then input.getBoolAttrValue('Preassigned') else OclUndefined endif ) } -- ----------------- -- SCHEDULING PARAMS -- ----------------- --- ---------- --- This rule ... --- ---------- rule Interrupt_FP_Params { from input : XML!Element (input.name = 'mast_mdl:Interrupt_FP_Params') to output : MAST2!Interrupt_FP_Params ( -- attrs. Priority <- if input.hasAttribute('Priority') then input.getIntAttrValue('Priority') else OclUndefined endif ) } --- ---------- --- This rule ... --- ---------- abstract rule Priority_Based_Params { from input : XML!Element to output : MAST2!Priority_Based_Params ( -- attrs. Priority <- if input.hasAttribute('Priority') then input.getIntAttrValue('Priority') else OclUndefined endif, Preassigned <- if input.hasAttribute('Preassigned') then input.getBoolAttrValue('Preassigned') else OclUndefined endif ) } --- ---------- --- This rule ... --- ---------- rule Fixed_Priority_Params extends Priority_Based_Params { from input : XML!Element (input.name = 'mast_mdl:Fixed_Priority_Params') to output : MAST2!Fixed_Priority_Params () } --- ---------- --- This rule ... --- ---------- rule Non_Preemptible_FP_Params extends Priority_Based_Params { from input : XML!Element (input.name = 'mast_mdl:Non_Preemptible_FP_Params') to output : MAST2!Non_Preemptible_FP_Params () } --- ---------- --- This rule ... --- ---------- rule Polling_Params extends Priority_Based_Params { from input : XML!Element (input.name = 'mast_mdl:Polling_Params') to output : MAST2!Polling_Params ( -- attrs. Polling_Period <- if input.hasAttribute('Polling_Period') then input.getRealAttrValue('Polling_Period') else OclUndefined endif, Polling_Worst_Overhead <- if input.hasAttribute('Polling_Worst_Overhead') then input.getRealAttrValue('Polling_Worst_Overhead') else OclUndefined endif, Polling_Avg_Overhead <- if input.hasAttribute('Polling_Avg_Overhead') then input.getRealAttrValue('Polling_Avg_Overhead') else OclUndefined endif, Polling_Best_Overhead <- if input.hasAttribute('Polling_Best_Overhead') then input.getRealAttrValue('Polling_Best_Overhead') else OclUndefined endif ) } --- ---------- --- This rule ... --- ---------- rule Periodic_Server_Params { from input : XML!Element (input.name = 'mast_mdl:Periodic_Server_Params') to output : MAST2!Periodic_Server_Params ( -- attrs. -- refs. ) } --- ---------- --- This rule ... --- ---------- rule Sporadic_Server_Params extends Priority_Based_Params { from input : XML!Element (input.name = 'mast_mdl:Sporadic_Server_Params') to output : MAST2!Sporadic_Server_Params ( -- attrs. Replenishment_Period <- if input.hasAttribute('Replenishment_Period') then input.getRealAttrValue('Replenishment_Period') else OclUndefined endif, Initial_Capacity <- if input.hasAttribute('Initial_Capacity') then input.getRealAttrValue('Initial_Capacity') else OclUndefined endif, Background_Priority <- if input.hasAttribute('Background_Priority') then input.getIntAttrValue('Background_Priority') else OclUndefined endif, Max_Pending_Replenishments <- if input.hasAttribute('Max_Pending_Replenishments') then input.getIntAttrValue('Max_Pending_Replenishments') else OclUndefined endif ) } --- ---------- --- This rule ... --- ---------- rule Periodic_Server_Comm_Params { from input : XML!Element (input.name = 'mast_mdl:Periodic_Server_Comm_Params') to output : MAST2!Periodic_Server_Comm_Params ( -- attrs. -- refs. ) } --- ---------- --- This rule ... --- ---------- rule Sporadic_Server_Comm_Params { from input : XML!Element (input.name = 'mast_mdl:Sporadic_Server_Comm_Params') to output : MAST2!Sporadic_Server_Comm_Params ( -- attrs. -- refs. ) } --- ---------- --- This rule ... --- ---------- rule EDF_Params { from input : XML!Element (input.name = 'mast_mdl:EDF_Params') to output : MAST2!EDF_Params ( -- attrs. Deadline <- if input.hasAttribute('Deadline') then input.getRealAttrValue('Deadline') else OclUndefined endif, Preassigned <- if input.hasAttribute('Preassigned') then input.getBoolAttrValue('Preassigned') else OclUndefined endif -- refs. -- Owner <- ) } --- ---------- --- This rule ... --- ---------- rule Virtual_Resource_Params { from input : XML!Element (input.name = 'mast_mdl:Virtual_Resource_Params') to output : MAST2!Virtual_Resource_Params ( -- attrs. -- refs. ) } --- ---------- --- This rule ... --- ---------- rule Virtual_Comm_Channel_Params { from input : XML!Element (input.name = 'mast_mdl:Virtual_Comm_Channel_Params') to output : MAST2!Virtual_Comm_Channel_Params ( -- attrs. -- refs. ) } --- ---------- --- This rule ... --- ---------- rule Virtual_Token_Bucket_Comm_Params { from input : XML!Element (input.name = 'mast_mdl:Virtual_Token_Bucket_Comm_Params') to output : MAST2!Virtual_Token_Bucket_Comm_Params ( -- attrs. -- refs. ) } --- ---------- --- This rule ... --- ---------- rule Partition_Params { from input : XML!Element (input.name = 'mast_mdl:Partition_Params') to output : MAST2!Partition_Params ( -- attrs. -- refs. ) } -- -------------------------- -- MUTUAL EXCLUSION RESOURCES -- -------------------------- --- ---------- --- This rule ... --- ---------- rule Priority_Inheritance_Mutex extends Model_Element { from input : XML!Element (input.name = 'mast_mdl:Priority_Inheritance_Mutex') to output : MAST2!Priority_Inheritance_Mutex () } --- ---------- --- This rule ... --- ---------- rule Immediate_Ceiling_Mutex extends Model_Element { from input : XML!Element (input.name = 'mast_mdl:Immediate_Ceiling_Mutex') to output : MAST2!Immediate_Ceiling_Mutex ( -- attrs. Ceiling <- if input.hasAttribute('Ceiling') then input.getIntAttrValue('Ceiling') else OclUndefined endif, Preassigned <- if input.hasAttribute('Preassigned') then input.getBoolAttrValue('Preassigned') else OclUndefined endif ) } --- ---------- --- This rule ... --- ---------- rule SRP_Mutex extends Model_Element { from input : XML!Element (input.name = 'mast_mdl:SRP_Mutex') to output : MAST2!SRP_Mutex ( -- attrs. Preemption_Level <- if input.hasAttribute('Preemption_Level') then input.getIntAttrValue('Preemption_Level') else OclUndefined endif, Preassigned <- if input.hasAttribute('Preassigned') then input.getBoolAttrValue('Preassigned') else OclUndefined endif ) } -- ----- -- OPERS -- ----- --- ---------- --- This rule ... --- ---------- abstract rule Code_Operation { --extends Model_Element { from input : XML!Element to output : MAST2!Code_Operation ( -- attrs. name <- input.getStringAttrValue('Name'), -- refs. -- Model <- -- Overridden_Sched_Parameters <- if input.hasChildrenElem() then -- input.getChildrenElem() -> select(e | e.name = 'mast_mdl:Overridden_Fixed_Priority' or -- e.name = 'mast_mdl:Overridden_Permanent_FP' or -- e.name = 'mast_mdl:Overridden_Deadline') -> first() -- else -- OclUndefined -- endif Overridden_Sched_Parameters <- if input.hasChildrenElemByPreffix('mast_mdl:Overriden') then input.getChildrenElemByPreffix('mast_mdl:Overriden') -> first() else OclUndefined endif ) } --- ---------- --- This rule ... --- ---------- rule Simple_Operation extends Code_Operation { from input : XML!Element (input.name = 'mast_mdl:Simple_Operation') to output : MAST2!Simple_Operation ( -- attrs. Worst_Case_Execution_Time <- if input.hasAttribute('Worst_Case_Execution_Time') then input.getRealAttrValue('Worst_Case_Execution_Time') else OclUndefined endif, Avg_Case_Execution_Time <- if input.hasAttribute('Avg_Case_Execution_Time') then input.getRealAttrValue('Avg_Case_Execution_Time') else OclUndefined endif, Best_Case_Execution_Time <- if input.hasAttribute('Best_Case_Execution_Time') then input.getRealAttrValue('Best_Case_Execution_Time') else OclUndefined endif -- refs. -- Mutex_List <- {do section} -- Mutex_To_Lock_List <- {do section} -- Mutex_To_Unlock_List <- {do section} ) do { if (input.hasChildrenElemByName('mast_mdl:Mutex')) { for (mutexElem in input.getChildrenElemByName('mast_mdl:Mutex')) { output.Mutex_List <- output.Model.Element_List -> select(e | e.oclIsKindOf(MAST2!Mutual_Exclusion_Resource)) -> select(m | m.name = mutexElem.getStringAttrValue('Name')) -> first(); } } if (input.hasChildrenElemByName('mast_mdl:Mutex_To_Lock')) { for (mutexToLockElem in input.getChildrenElemByName('mast_mdl:Mutex_To_Lock')) { output.Mutex_To_Lock_List <- output.Model.Element_List -> select(e | e.oclIsKindOf(MAST2!Mutual_Exclusion_Resource)) -> select(m | m.name = mutexToLockElem.getStringAttrValue('Name')) -> first(); } } if (input.hasChildrenElemByName('mast_mdl:Mutex_To_Unlock')) { for (mutexToUnlockElem in input.getChildrenElemByName('mast_mdl:Mutex_To_Unlock')) { output.Mutex_To_Unlock_List <- output.Model.Element_List -> select(e | e.oclIsKindOf(MAST2!Mutual_Exclusion_Resource)) -> select(m | m.name = mutexToUnlockElem.getStringAttrValue('Name')) -> first(); } } } } --- ---------- --- This rule ... --- ---------- rule Composite_Operation extends Code_Operation { from input : XML!Element (input.name = 'mast_mdl:Composite_Operation') to output : MAST2!Composite_Operation ( -- refs. -- Operation_List <- {do section} ) do { for (operElem in input.getChildrenElemByName('mast_mdl:Operation')) { output.Operation_List <- output.Model.Element_List -> select(e | e.oclIsKindOf(MAST2!Code_Operation)) -> select(co | co.name = operElem.getStringAttrValue('Name')) -> first(); } } } --- ---------- --- This rule ... --- ---------- rule Enclosing_Operation extends Code_Operation { from input : XML!Element (input.name = 'mast_mdl:Enclosing_Operation') to output : MAST2!Enclosing_Operation ( -- attrs. Worst_Case_Execution_Time <- if input.hasAttribute('Worst_Case_Execution_Time') then input.getRealAttrValue('Worst_Case_Execution_Time') else OclUndefined endif, Avg_Case_Execution_Time <- if input.hasAttribute('Avg_Case_Execution_Time') then input.getRealAttrValue('Avg_Case_Execution_Time') else OclUndefined endif, Best_Case_Execution_Time <- if input.hasAttribute('Best_Case_Execution_Time') then input.getRealAttrValue('Best_Case_Execution_Time') else OclUndefined endif -- refs. -- Operation_List <- {do section} ) do { for (operElem in input.getChildrenElemByName('mast_mdl:Operation')) { output.Operation_List <- output.Model.Element_List -> select(e | e.oclIsKindOf(MAST2!Code_Operation)) -> select(co | co.name = operElem.getStringAttrValue('Name')) -> first(); } } } --- ---------- --- This rule ... --- ---------- rule Message extends Model_Element { from input : XML!Element (input.name = 'mast_mdl:Message') to output : MAST2!Message ( -- attrs. Max_Message_Size <- if input.hasAttribute('Max_Message_Size') then input.getIntAttrValue('Max_Message_Size') else OclUndefined endif, Avg_Message_Size <- if input.hasAttribute('Avg_Message_Size') then input.getIntAttrValue('Avg_Message_Size') else OclUndefined endif, Min_Message_Size <- if input.hasAttribute('Min_Message_Size') then input.getIntAttrValue('Min_Message_Size') else OclUndefined endif ) } --- ---------- --- This rule ... --- ---------- rule Composite_Message { from input : XML!Element (input.name = 'mast_mdl:Composite_Message') to output : MAST2!Composite_Message ( -- refs. -- Message_List <- {do section} ) do { for (mssgElem in input.getChildrenElemByName('mast_mdl:Message')) { output.Message_List <- output.Model.Element_List -> select(e | e.oclIsKindOf(MAST2!Message)) -> select(m | m.name = mssgElem.getStringAttrValue('Name')) -> first(); } } } -- ---------------- -- OVERRIDEN PARAMS -- ---------------- --- ---------- --- This rule ... --- ---------- rule Overridden_Fixed_Priority { from input : XML!Element (input.name = 'mast_mdl:Overridden_Fixed_Priority') to output : MAST2!Overridden_Fixed_Priority ( -- attrs. Priority <- if input.hasAttribute('Priority') then input.getIntAttrValue('Priority') else OclUndefined endif ) } --- ---------- --- This rule ... --- ---------- rule Overridden_Permanent_FP { from input : XML!Element (input.name = 'mast_mdl:Overridden_Permanent_FP') to output : MAST2!Overridden_Permanent_FP ( -- attrs. Priority <- if input.hasAttribute('Priority') then input.getIntAttrValue('Priority') else OclUndefined endif ) } --- ---------- --- This rule ... --- ---------- rule Overridden_Deadline { from input : XML!Element (input.name = 'mast_mdl:Overridden_Deadline') to output : MAST2!Overridden_Deadline ( -- attrs. -- refs. ) } -- ------------ -- TRANSACTIONS -- ------------ --- ---------- --- This rule ... --- ---------- rule Regular_End_To_End_Flow extends Model_Element { from input : XML!Element (input.name = 'mast_mdl:Regular_End_To_End_Flow') to output : MAST2!Regular_End_To_End_Flow ( -- refs. Flow_Element_List <- input.getChildrenElem() -- -> select(e | e.name = 'mast_mdl:Singular_Event' or -- e.name = 'mast_mdl:Periodic_Event' or -- e.name = 'mast_mdl:Unbounded_Event' or -- e.name = 'mast_mdl:Sporadic_Event' or -- e.name = 'mast_mdl:Bursty_Event' or -- e.name = 'mast_mdl:Internal_Event' or -- e.name = 'mast_mdl:Step' or -- e.name = 'mast_mdl:Rate_Divisor' or -- e.name = 'mast_mdl:Delay' or -- e.name = 'mast_mdl:Offset' or -- e.name = 'mast_mdl:Merge' or -- e.name = 'mast_mdl:Join' or -- e.name = 'mast_mdl:Fork' or -- e.name = 'mast_mdl:Branch' or -- e.name = 'mast_mdl:Queried_Branch' or -- e.name = 'mast_mdl:Message_Fork' or -- e.name = 'mast_mdl:Message_Delivery' or -- e.name = 'mast_mdl:Message_Branch') ) } -- --------------- -- EXTERNAL EVENTS -- --------------- --- ---------- --- This rule ... --- ---------- abstract rule Workload_Event { from input : XML!Element to output : MAST2!Workload_Event ( -- attrs. name <- input.getStringAttrValue('Name') -- refs. -- Owner <- ) } --- ---------- --- This rule ... --- ---------- abstract rule Timed_Event extends Workload_Event { from input : XML!Element to output : MAST2!Timed_Event ( -- attrs. Phase <- if input.hasAttribute('Phase') then input.getRealAttrValue('Phase') else OclUndefined endif -- refs. -- Timer <- {do section} ) } --- ---------- --- This rule ... --- ---------- rule Singular_Event extends Timed_Event { from input : XML!Element (input.name = 'mast_mdl:Singular_Event') to output : MAST2!Singular_Event ( -- refs. -- Timer <- {do section} ) do { if (input.hasAttribute('Timer')) output.Timer <- output.Owner.Model.Element_List -> select(e | e.oclIsKindOf(MAST2!Timer)) -> select(t | t.name = input.getStringAttrValue('Timer')) -> first(); } } --- ---------- --- This rule ... --- ---------- rule Periodic_Event extends Timed_Event { from input : XML!Element (input.name = 'mast_mdl:Periodic_Event') to output : MAST2!Periodic_Event ( -- attrs. Period <- if input.hasAttribute('Period') then input.getRealAttrValue('Period') else OclUndefined endif, Max_Jitter <- if input.hasAttribute('Max_Jitter') then input.getRealAttrValue('Max_Jitter') else OclUndefined endif, Synchronized <- if input.hasAttribute('Synchronized') then input.getBoolAttrValue('Synchronized') else OclUndefined endif -- refs. -- Timer <- {do section} ) do { if (input.hasAttribute('Timer')) output.Timer <- output.Owner.Model.Element_List -> select(e | e.oclIsKindOf(MAST2!Timer)) -> select(t | t.name = input.getStringAttrValue('Timer')) -> first(); } } --- ---------- --- This rule ... --- ---------- rule Unbounded_Event extends Workload_Event { from input : XML!Element (input.name = 'mast_mdl:Unbounded_Event') to output : MAST2!Unbounded_Event ( -- attrs. Distribution <- if input.hasAttribute('Distribution') then input.getStringAttrValue('Distribution') else OclUndefined endif, Avg_Interarrival <- if input.hasAttribute('Avg_Interarrival') then input.getRealAttrValue('Avg_Interarrival') else OclUndefined endif ) } --- ---------- --- This rule ... --- ---------- rule Sporadic_Event extends Workload_Event { from input : XML!Element (input.name = 'mast_mdl:Sporadic_Event') to output : MAST2!Sporadic_Event ( -- attrs. Distribution <- if input.hasAttribute('Distribution') then input.getStringAttrValue('Distribution') else OclUndefined endif, Avg_Interarrival <- if input.hasAttribute('Avg_Interarrival') then input.getRealAttrValue('Avg_Interarrival') else OclUndefined endif, Min_Interarrival <- if input.hasAttribute('Min_Interarrival') then input.getRealAttrValue('Min_Interarrival') else OclUndefined endif ) } --- ---------- --- This rule ... --- ---------- rule Bursty_Event extends Workload_Event { from input : XML!Element (input.name = 'mast_mdl:Bursty_Event') to output : MAST2!Bursty_Event ( -- attrs. Distribution <- if input.hasAttribute('Distribution') then input.getStringAttrValue('Distribution') else OclUndefined endif, Avg_Interarrival <- if input.hasAttribute('Avg_Interarrival') then input.getRealAttrValue('Avg_Interarrival') else OclUndefined endif, Bound_Interval <- if input.hasAttribute('Bound_Interval') then input.getRealAttrValue('Bound_Interval') else OclUndefined endif, Max_Arrivals <- if input.hasAttribute('Max_Arrivals') then input.getIntAttrValue('Max_Arrivals') else OclUndefined endif ) } -- -------------- -- INTERNAL EVENT -- -------------- --- ---------- --- This rule ... --- ---------- rule Internal_Event { from input : XML!Element (input.name = 'mast_mdl:Internal_Event') to output : MAST2!Internal_Event ( -- attrs. name <- input.getStringAttrValue('Name'), -- refs. -- Owner <- Observer_List <- if input.hasChildrenElem() then input.getChildrenElem() -- -> select(e | e.name = 'mast_mdl:Max_Output_Jitter_Req' or -- e.name = 'mast_mdl:Local_Max_Miss_Ratio' or -- e.name = 'mast_mdl:Global_Max_Miss_Ratio' or -- e.name = 'mast_mdl:Hard_Local_Deadline' or -- e.name = 'mast_mdl:Soft_Local_Deadline' or -- e.name = 'mast_mdl:Hard_Global_Deadline' or -- e.name = 'mast_mdl:Hard_Global_Relative_Deadline' or -- e.name = 'mast_mdl:Soft_Global_Deadline' or -- e.name = 'mast_mdl:Soft_Global_Relative_Deadline' or -- e.name = 'mast_mdl:Queue_Size_Req' or -- e.name = 'mast_mdl:Composite_Observer') else OclUndefined endif ) } -- --------- -- OBSERVERS -- --------- --- ---------- --- This rule ... --- ---------- abstract rule Max_Miss_Ratio { from input : XML!Element to output : MAST2!Max_Miss_Ratio_Req ( -- attrs. Deadline <- if input.hasAttribute('Deadline') then input.getRealAttrValue('Deadline') else OclUndefined endif, Ratio <- if input.hasAttribute('Ratio') then input.getRealAttrValue('Ratio') else OclUndefined endif -- refs. -- Owner_IE <- -- Owner_CO <- ) } --- ---------- --- This rule ... --- ---------- rule Local_Max_Miss_Ratio extends Max_Miss_Ratio { from input : XML!Element (input.name = 'mast_mdl:Local_Max_Miss_Ratio') to output : MAST2!Local_Max_Miss_Ratio () } --- ---------- --- This rule ... --- ---------- rule Global_Max_Miss_Ratio extends Max_Miss_Ratio { from input : XML!Element (input.name = 'mast_mdl:Global_Max_Miss_Ratio') to output : MAST2!Global_Max_Miss_Ratio ( -- refs. -- Referenced_Event <- {do section} ) do { if (not output.Owner_IE.oclIsUndefined()) output.Referenced_Event <- output.Owner_IE.Owner.Flow_Element_List -> select(fe | fe.oclIsKindOf(MAST2!Workload_Event)) -> select(we | we.name = input.getStringAttrValue('Referenced_Event')) -> first(); else output.Referenced_Event <- output.Owner_CO.Owner_IE.Owner.Flow_Element_List -> select(fe | fe.oclIsKindOf(MAST2!Workload_Event)) -> select(we | we.name = input.getStringAttrValue('Referenced_Event')) -> first(); } } --- ---------- --- This rule ... --- ---------- abstract rule Deadline { from input : XML!Element to output : MAST2!Deadline_Req ( -- attrs. Deadline <- if input.hasAttribute('Deadline') then input.getRealAttrValue('Deadline') else OclUndefined endif -- refs. -- Owner_IE <- -- Owner_CO <- ) } --- ---------- --- This rule ... --- ---------- rule Soft_Local_Deadline extends Deadline { from input : XML!Element (input.name = 'mast_mdl:Soft_Local_Deadline') to output : MAST2!Soft_Local_Deadline () } --- ---------- --- This rule ... --- ---------- rule Hard_Local_Deadline extends Deadline { from input : XML!Element (input.name = 'mast_mdl:Hard_Local_Deadline') to output : MAST2!Hard_Local_Deadline () } --- ---------- --- This rule ... --- ---------- rule Soft_Global_Deadline extends Deadline { from input : XML!Element (input.name = 'mast_mdl:Soft_Global_Deadline') to output : MAST2!Soft_Global_Deadline ( -- refs. -- Referenced_Event <- {do section} ) do { if (not output.Owner_IE.oclIsUndefined()) output.Referenced_Event <- output.Owner_IE.Owner.Flow_Element_List -> select(fe | fe.oclIsKindOf(MAST2!Workload_Event)) -> select(we | we.name = input.getStringAttrValue('Referenced_Event')) -> first(); else output.Referenced_Event <- output.Owner_CO.Owner_IE.Owner.Flow_Element_List -> select(fe | fe.oclIsKindOf(MAST2!Workload_Event)) -> select(we | we.name = input.getStringAttrValue('Referenced_Event')) -> first(); } } --- ---------- --- This rule ... --- ---------- rule Hard_Global_Deadline extends Deadline { from input : XML!Element (input.name = 'mast_mdl:Hard_Global_Deadline') to output : MAST2!Hard_Global_Deadline ( -- refs. -- Referenced_Event <- {do section} ) do { if (not output.Owner_IE.oclIsUndefined()) output.Referenced_Event <- output.Owner_IE.Owner.Flow_Element_List -> select(fe | fe.oclIsKindOf(MAST2!Workload_Event)) -> select(we | we.name = input.getStringAttrValue('Referenced_Event')) -> first(); else output.Referenced_Event <- output.Owner_CO.Owner_IE.Owner.Flow_Element_List -> select(fe | fe.oclIsKindOf(MAST2!Workload_Event)) -> select(we | we.name = input.getStringAttrValue('Referenced_Event')) -> first(); } } --- ---------- --- This rule ... --- ---------- rule Soft_Global_Relative_Deadline { from input : XML!Element (input.name = 'mast_mdl:Soft_Global_Relative_Deadline') to output : MAST2!Soft_Global_Relative_Deadline ( -- attrs. -- refs. ) } --- ---------- --- This rule ... --- ---------- rule Hard_Global_Relative_Deadline { from input : XML!Element (input.name = 'mast_mdl:Hard_Global_Relative_Deadline') to output : MAST2!Hard_Global_Relative_Deadline ( -- attrs. -- refs. ) } --- ---------- --- This rule ... --- ---------- rule Max_Output_Jitter_Req { from input : XML!Element (input.name = 'mast_mdl:Max_Output_Jitter_Req') to output : MAST2!Max_Output_Jitter_Req ( -- attrs. Max_Output_Jitter <- if input.hasAttribute('Max_Output_Jitter') then input.getRealAttrValue('Max_Output_Jitter') else OclUndefined endif -- refs. -- Owner_IE <- -- Owner_CO <- -- Referenced_Event <- {do section} ) do { if (not output.Owner_IE.oclIsUndefined()) output.Referenced_Event <- output.Owner_IE.Owner.Flow_Element_List -> select(fe | fe.oclIsKindOf(MAST2!Workload_Event)) -> select(we | we.name = input.getStringAttrValue('Referenced_Event')) -> first(); else output.Referenced_Event <- output.Owner_CO.Owner_IE.Owner.Flow_Element_List -> select(fe | fe.oclIsKindOf(MAST2!Workload_Event)) -> select(we | we.name = input.getStringAttrValue('Referenced_Event')) -> first(); } } --- ---------- --- This rule ... --- ---------- rule Queue_Size_Req { from input : XML!Element (input.name = 'mast_mdl:Queue_Size_Req') to output : MAST2!Queue_Size_Req ( -- attrs. -- refs. ) } --- ---------- --- This rule ... --- ---------- rule Composite_Observer { from input : XML!Element (input.name = 'mast_mdl:Composite_Observer') to output : MAST2!Composite_Observer ( -- refs. -- Owner_IE <- -- Owner_CO <- Observer_List <- input.getChildrenElem() -- -> select(e | e.name = 'mast_mdl:Max_Output_Jitter_Req' or -- e.name = 'mast_mdl:Local_Max_Miss_Ratio' or -- e.name = 'mast_mdl:Global_Max_Miss_Ratio' or -- e.name = 'mast_mdl:Hard_Local_Deadline' or -- e.name = 'mast_mdl:Soft_Local_Deadline' or -- e.name = 'mast_mdl:Hard_Global_Deadline' or -- e.name = 'mast_mdl:Hard_Global_Relative_Deadline' or -- e.name = 'mast_mdl:Soft_Global_Deadline' or -- e.name = 'mast_mdl:Soft_Global_Relative_Deadline' or -- e.name = 'mast_mdl:Queue_Size_Req') ) } -- -------------- -- EVENT HANDLERS -- -------------- --- ---------- --- This rule ... --- ---------- rule Step { from input : XML!Element (input.name = 'mast_mdl:Step') to output : MAST2!Step ( -- refs. -- Input_Event <- {do section} -- Output_Event <- {do section} -- Step_Operation <- {do section} -- Step_Schedulable_Resource <- {do section} ) do { output.Input_Event <- output.Owner.Flow_Element_List -> select(fe | fe.oclIsKindOf(MAST2!Event)) -> select(ev | ev.name = input.getStringAttrValue('Input_Event')) -> first(); output.Output_Event <- output.Owner.Flow_Element_List -> select(fe | fe.oclIsTypeOf(MAST2!Internal_Event)) -> select(ev | ev.name = input.getStringAttrValue('Output_Event')) -> first(); output.Step_Operation <- output.Owner.Model.Element_List -> select(e | e.oclIsKindOf(MAST2!Operation)) -> select(o | o.name = input.getStringAttrValue('Step_Operation')) -> first(); output.Step_Schedulable_Resource <- output.Owner.Model.Element_List -> select(e | e.oclIsKindOf(MAST2!Schedulable_Resource)) -> select(sr | sr.name = input.getStringAttrValue('Step_Schedulable_Resource')) -> first(); } } --- ---------- --- This rule ... --- ---------- rule Rate_Divisor { from input : XML!Element (input.name = 'mast_mdl:Rate_Divisor') to output : MAST2!Rate_Divisor ( -- attrs. Rate_Factor <- if input.hasAttribute('Rate_Factor') then input.getIntAttrValue('Rate_Factor') else OclUndefined endif -- refs. -- Input_Event <- {do section} -- Output_Event <- {do section} ) do { output.Input_Event <- output.Owner.Flow_Element_List -> select(fe | fe.oclIsKindOf(MAST2!Event)) -> select(ev | ev.name = input.getStringAttrValue('Input_Event')) -> first(); output.Output_Event <- output.Owner.Flow_Element_List -> select(fe | fe.oclIsTypeOf(MAST2!Internal_Event)) -> select(ev | ev.name = input.getStringAttrValue('Output_Event')) -> first(); } } --- ---------- --- This rule ... --- ---------- rule Delay { from input : XML!Element (input.name = 'mast_mdl:Delay') to output : MAST2!Delay ( -- attrs. Delay_Max_Interval <- if input.hasAttribute('Delay_Max_Interval') then input.getRealAttrValue('Delay_Max_Interval') else OclUndefined endif, Delay_Avg_Interval <- if input.hasAttribute('Delay_Avg_Interval') then input.getRealAttrValue('Delay_Avg_Interval') else OclUndefined endif, Delay_Best_Interval <- if input.hasAttribute('Delay_Min_Interval') then input.getRealAttrValue('Delay_Min_Interval') else OclUndefined endif -- refs. -- Input_Event <- {do section} -- Output_Event <- {do section} -- Timer <- {do section} ) do { output.Input_Event <- output.Owner.Flow_Element_List -> select(fe | fe.oclIsKindOf(MAST2!Event)) -> select(ev | ev.name = input.getStringAttrValue('Input_Event')) -> first(); output.Output_Event <- output.Owner.Flow_Element_List -> select(fe | fe.oclIsTypeOf(MAST2!Internal_Event)) -> select(ev | ev.name = input.getStringAttrValue('Output_Event')) -> first(); if (input.hasAttribute('Timer')) output.Timer <- output.Owner.Model.Element_List -> select(e | e.oclIsKindOf(MAST2!Timer)) -> select(t | t.name = input.getStringAttrValue('Timer')) -> first(); } } --- ---------- --- This rule ... --- ---------- rule Offset extends Delay { from input : XML!Element (input.name = 'mast_mdl:Offset') to output : MAST2!Offset ( -- Referenced_Event <- {do section} ) do { output.Referenced_Event <- output.Owner.Flow_Element_List -> select(fe | fe.oclIsKindOf(MAST2!Workload_Event)) -> select(we | we.name = input.getStringAttrValue('Referenced_Event')) -> first(); } } --- ---------- --- This rule ... --- ---------- rule Merge { from input : XML!Element (input.name = 'mast_mdl:Merge') to output : MAST2!Merge ( -- refs. -- Input_Event_List <- {do section} -- Output_Event <- {do section} ) do { for (inputEventName in input.getStringAttrValue('Input_Events_List').split(' ')) { output.Input_Event_List <- output.Owner.Flow_Element_List -> select(fe | fe.oclIsKindOf(MAST2!Event)) -> select(ev | ev.name = inputEventName) -> first(); } output.Output_Event <- output.Owner.Flow_Element_List -> select(fe | fe.oclIsTypeOf(MAST2!Internal_Event)) -> select(ev | ev.name = input.getStringAttrValue('Output_Event')) -> first(); } } --- ---------- --- This rule ... --- ---------- rule Join { from input : XML!Element (input.name = 'mast_mdl:Join') to output : MAST2!Join ( -- refs. -- Input_Event_List <- {do section} -- Output_Event <- {do section} ) do { for (inputEventName in input.getStringAttrValue('Input_Events_List').split(' ')) { output.Input_Event_List <- output.Owner.Flow_Element_List -> select(fe | fe.oclIsKindOf(MAST2!Event)) -> select(ev | ev.name = inputEventName) -> first(); } output.Output_Event <- output.Owner.Flow_Element_List -> select(fe | fe.oclIsTypeOf(MAST2!Internal_Event)) -> select(ev | ev.name = input.getStringAttrValue('Output_Event')) -> first(); } } --- ---------- --- This rule ... --- ---------- rule Fork { from input : XML!Element (input.name = 'mast_mdl:Fork') to output : MAST2!Fork ( -- refs. -- Input_Event <- {do section} -- Output_Event_List <- {do section} ) do { output.Input_Event <- output.Owner.Flow_Element_List -> select(fe | fe.oclIsKindOf(MAST2!Event)) -> select(ev | ev.name = input.getStringAttrValue('Input_Event')) -> first(); for (outputEventName in input.getStringAttrValue('Output_Events_List').split(' ')) { output.Output_Event_List <- output.Owner.Flow_Element_List -> select(fe | fe.oclIsTypeOf(MAST2!Internal_Event)) -> select(ev | ev.name = outputEventName) -> first(); } } } --- ---------- --- This rule ... --- ---------- rule Branch { from input : XML!Element (input.name = 'mast_mdl:Branch') to output : MAST2!Branch ( -- attrs. Delivery_Policy <- if input.hasAttribute('Delivery_Policy') then input.getStringAttrValue('Delivery_Policy') else OclUndefined endif -- Output_Weight_List <- {do section} -- refs. -- Input_Event <- {do section} -- Output_Event_List <- {do section} ) do { output.Input_Event <- output.Owner.Flow_Element_List -> select(fe | fe.oclIsKindOf(MAST2!Event)) -> select(ev | ev.name = input.getStringAttrValue('Input_Event')) -> first(); for (outputEventName in input.getStringAttrValue('Output_Events_List').split(' ')) { output.Output_Event_List <- output.Owner.Flow_Element_List -> select(fe | fe.oclIsTypeOf(MAST2!Internal_Event)) -> select(ev | ev.name = outputEventName) -> first(); output.Output_Weight_List <- 1; } } } --- ---------- --- This rule ... --- ---------- rule Queried_Branch { from input : XML!Element (input.name = 'mast_mdl:Queried_Branch') to output : MAST2!Queried_Branch ( -- attrs. Request_Policy <- if input.hasAttribute('Request_Policy') then input.getStringAttrValue('Request_Policy') else OclUndefined endif -- refs. -- Input_Event <- {do section} -- Output_Event_List <- {do section} ) do { output.Input_Event <- output.Owner.Flow_Element_List -> select(fe | fe.oclIsKindOf(MAST2!Event)) -> select(ev | ev.name = input.getStringAttrValue('Input_Event')) -> first(); for (outputEventName in input.getStringAttrValue('Output_Events_List').split(' ')) { output.Output_Event_List <- output.Owner.Flow_Element_List -> select(fe | fe.oclIsTypeOf(MAST2!Internal_Event)) -> select(ev | ev.name = outputEventName) -> first(); } } } --- ---------- --- This rule ... --- ---------- rule Message_Delivery { from input : XML!Element (input.name = 'mast_mdl:Message_Delivery') to output : MAST2!Message_Delivery ( -- attrs. -- refs. ) } --- ---------- --- This rule ... --- ---------- rule Message_Fork { from input : XML!Element (input.name = 'mast_mdl:Message_Fork') to output : MAST2!Message_Fork ( -- attrs. -- refs. ) } --- ---------- --- This rule ... --- ---------- rule Message_Branch { from input : XML!Element (input.name = 'mast_mdl:Message_Branch') to output : MAST2!Message_Branch ( -- attrs. -- refs. ) }